﻿#region Header
// ------------------------ Licence / Copyright ------------------------
// 
// ScrumTable for Scrum Meeting Support
// Copyright © HSR - Hochschule für Technik Rapperswil
// All Rights Reserved
// 
// Author:
//  Michael Gfeller Silvan Gehrig Patrick Boos
// 
// ---------------------------------------------------------------------
#endregion

#region Usings

using System;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using ScrumTable.BL.DM.DataManagement;
using ScrumTable.Common;
using ErrorType = System.Collections.ObjectModel.ObservableCollection<ScrumTable.UI.ViewModel.IScrumItemViewModel<ScrumTable.BL.DM.DataManagement.DomainBase>>;

#endregion

namespace ScrumTable.UI.ViewModel.Tools.Toast
{

  
    /// <summary>
    /// Description of the class
    /// </summary>
    public abstract class ToastBaseProvider : ViewModelBase
    {
     
        #region Declarations
        //--------------------------------------------------------------------
        // Declarations
        //--------------------------------------------------------------------
        
        

        #endregion

        #region Properties
        //--------------------------------------------------------------------
        // Properties
        //--------------------------------------------------------------------



        public ToastList Toasts { get; set; }
        public abstract ToastType ToastType { get; }



        #endregion

        #region Constructors / Destructor
        //--------------------------------------------------------------------
        // Constructors / Destructor
        //--------------------------------------------------------------------
        protected ToastBaseProvider(ToastList toasts)
        {
            Toasts = toasts;
        }

        #endregion

        #region Methods
        //--------------------------------------------------------------------
        // Methods
        //--------------------------------------------------------------------

        protected override void ReleaseManagedResources()
        {
            for (int index = Toasts.Count-1; index >= 0; --index)
            {
                var toast = Toasts[index];
                if (toast.Type == ToastType)
                {
                    Toasts.Remove(toast);
                }
            }
            base.ReleaseManagedResources();
        }

        #endregion

    }
}